'''
fixtures:
setUp()方法级别：重点掌握
tearDown()方法级别：重点掌握
setUpClass()类级别
tearDownClass()类级别
'''
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
from options import options
import unittest

url = r'https://www.baidu.com/'


class TestBaidu(unittest.TestCase):
    @classmethod
    def setUpClass(cls) -> None:
        cls.driver = webdriver.Chrome(options=options)
        cls.driver.get(url)

    def setUp(self) -> None:
        pass

    def test_search1(self):
        self.driver.find_element(By.ID, 'kw').clear()
        self.driver.find_element(By.ID, 'kw').send_keys('1111111111111111111')
        sleep(3)

    def test_search2(self):
        self.driver.find_element(By.ID, 'kw').clear()
        self.driver.find_element(By.ID, 'kw').send_keys('2222222222222222')
        sleep(3)

    def tearDown(self) -> None:
        pass

    @classmethod
    def tearDownClass(cls) -> None:
        cls.driver.quit()


if __name__ == '__main__':
    unittest.main()
